local lPlayer = FindMetaTable("Player")

function lPlayer:Ch_SetModel( model )
	self.MODEL = model
	self:SetNetworkedVar("CHARACTER_MODEL", self.MODEL)
	self:SavePlayer()
end

function lPlayer:Ch_Init()
	local ch_model = SQL_ReadValue(self:SteamID(), "model")
	if (ch_model == '') then
		umsg.Start( "OPEN_CHARACTER_MENU" )
		umsg.End()
	else
		self:Ch_SetModel(ch_model)
	end
end

function lPlayer:Ch_GetModel()
	return self.MODEL
end

function Stream_Ch_Change_Model( ply, handler, id, encoded, decoded )
	ply:Ch_SetModel(decoded[1])
end

datastream.Hook( "CL_SEND_CHARACTER_MODEL", Stream_Ch_Change_Model )

function GM:PlayerSetModel( ply )
 
	ply:SetModel( player_manager.TranslatePlayerModel(ply:Ch_GetModel()) )
 
end